﻿using System;
using System.Linq;

namespace Loki.UI.Win
{
    public class StringFormatConverter : IMultiValueConverter
    {
        public string FormatString { get; private set; }

        public StringFormatConverter(string P_FormatString)
        {
            FormatString = P_FormatString;
        }

        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (parameter == null)
                return string.Format(culture, FormatString, values);
            else
                return string.Format(culture, FormatString, values.Concat(new object[] { parameter }).ToArray());
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}
